<?PHP
  class DataCenter extends Editor{
    function __construct($page){
      $this->page = $page;
    }
  
    public function display(){
      echo "<div style=\"width:300px;margin-right:10px;float:left;\"><h2>Datentypen</h2>";
      $list = new LinkList();
      $host = Settings::getInstance()->get("host");
      $list->fillSelect = "SELECT displayName as text, CONCAT('".$host."admin/data.html?show=',id) as href FROM {'dbprefix'}datatypes ORDER BY displayName";
      $list->display();
      echo "</div>";
      if($_GET['show']){
        $id = $GLOBALS['db']->EscapeString($_GET['show']);
        $datatype = $GLOBALS['db']->ReadRow("SELECT * FROM {'dbprefix'}datatypes WHERE id = '".$id."'");
        echo "<div><h2>".htmlentities($datatype->displayName)."</h2><p>".htmlentities($datatype->description)."</p><h2>Eigenschaften</h2>";
        $table       = new Table();
        $displayName = new TableColumn("displayName","Name");
        $dataName    = new TableColumn("dataName","Datenname");
        $validator   = new TableColumn("validator_name","Inhalt","IFNULL((SELECT name FROM {'dbprefix'}data_validator WHERE id = {'dbprefix'}datafields.validator),'')");
        $table->columns->add($displayName);
        $table->columns->add($dataName);
        $table->columns->add($validator);
        $displayName->autoWidth = true;
        $validator->autoWidth = true;
        $table->condition = "dataType = '".$_GET['show']."'";
        $table->name      = "{'dbprefix'}datafields";
        $table->orderBy   = "displayName";
        $table->display();
        echo "</div>";
      }
    }

    function getHeader(){
    }
    
    public function getEditableCode(){
      return "<input name=\"save\" type=\"submit\" value=\"&Auml;ndern\" onclick=\"form.action='".$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']."' ; target='_self' ; return true\" />";
    }
    
    public function save($newPage,$oldPage){
    }    
}
?>